package org.theSeed.fileContract.pojo.vo;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;
import lombok.Setter;
import org.theSeed.base.exp.BuzExp;
import org.theSeed.base.pojo.sysEnum.SysCode;
import org.theSeed.fileContract.contract.FileContract;
import org.theSeed.fileContract.exp.FileUploadExp;

/**
 * 文件适配处理对象
 */
@Getter
@Setter
public class ResourceUrlDividVo {
    public ResourceUrlDividVo() {
    }

    public ResourceUrlDividVo(FileContract fileContract, String resourceId) {
        this.fileContract = fileContract;
        this.resourceId = resourceId;
    }

    /**
     * 处理对象
     */
    private FileContract fileContract;

    /**
     * 资源id
     */
    private String resourceId;

    /**
     * 数据校验
     */
    public void checkParam(){
        if (ObjectUtil.isNull(fileContract))
            throw new FileUploadExp("文件操作失败:不存在对应的oss");

        if (ObjectUtil.isEmpty(resourceId)){
            throw new FileUploadExp("文件上传失败:resourceUrl不能为空");
        }
    }
}
